home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-04-25 | 1.8 KB | 62 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: SLLocale.cpp
- // Release Version: $ ODF 1 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #include "FWFound.hpp"
-
- #ifndef SLLOCALE_H
- #include "SLLocale.h"
- #endif
-
- #if defined(FW_BUILD_MAC) && !defined(__SCRIPT__)
- #include <Script.h>
- #endif
-
- #ifdef FW_BUILD_MAC
- #pragma segment Strings
- #endif
-
- //========================================================================================
- // FW_MacScriptIsSingleByte
- //========================================================================================
-
- #ifdef FW_BUILD_MAC
- static FW_Boolean FW_MacScriptIsSingleByte(short script)
- {
- static short gCachedScriptCode = smRoman;
- static long gCachedScriptIsSingleByte = true;
- if (script != gCachedScriptCode)
- {
- gCachedScriptCode = script;
- long flags = GetScriptVariable(script, smScriptFlags);
- gCachedScriptIsSingleByte = (flags & (1L<<smsfSingByte))!=0;
- }
- return gCachedScriptIsSingleByte;
- }
- #endif
-
- //========================================================================================
- // FW_LocaleIsSingleByte
- //========================================================================================
-
- FW_Boolean FW_LocaleIsSingleByte(FW_Locale locale)
- {
- #ifdef FW_BUILD_MAC
- return FW_MacScriptIsSingleByte(locale.fScriptCode);
- #elif defined FW_BUILD_WIN
- return true;
-
- // Someday, the code will look something like this:
- //CPINFO cpinfo;
- //GetACP(locale, &cpinfo);
- //return cpinfo.MaxCharSize == 1;
- // If GetACP might be expensive, it might be worthwhile mimicking the above
- // routine which caches the result of the last call.
- #endif
- }
-